Nightly Per-Antenna Quality Summary Notebook¶

Josh Dillon, Last Revised February 2021

This notebooks brings together as much information as possible from ant_metrics, auto_metrics and redcal to help figure out which antennas are working properly and summarizes it in a single giant table. It is meant to be lightweight and re-run as often as necessary over the night, so it can be run when any of those is done and then be updated when another one completes.

Contents:¶

  • Table 1: Overall Array Health
  • Table 2: RTP Per-Antenna Metrics Summary Table
  • Figure 1: Array Plot of Flags and A Priori Statuses
In [1]:
import os
os.environ['HDF5_USE_FILE_LOCKING'] = 'FALSE'
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
import pandas as pd
pd.set_option('display.max_rows', 1000)
from hera_qm.metrics_io import load_metric_file
from hera_cal import utils, io, redcal
import glob
import h5py
from copy import deepcopy
from IPython.display import display, HTML
from hera_notebook_templates.utils import status_colors
from hera_mc import mc
from pyuvdata import UVData

%matplotlib inline
%config InlineBackend.figure_format = 'retina'
display(HTML("<style>.container { width:100% !important; }</style>"))
In [2]:
# If you want to run this notebook locally, copy the output of the next cell into the first few lines of this cell.

# JD = "2459122"
# data_path = '/lustre/aoc/projects/hera/H4C/2459122'
# ant_metrics_ext = ".ant_metrics.hdf5"
# redcal_ext = ".maybe_good.omni.calfits"
# nb_outdir = '/lustre/aoc/projects/hera/H4C/h4c_software/H4C_Notebooks/_rtp_summary_'
# good_statuses = "digital_ok,calibration_maintenance,calibration_triage,calibration_ok"
# os.environ["JULIANDATE"] = JD
# os.environ["DATA_PATH"] = data_path
# os.environ["ANT_METRICS_EXT"] = ant_metrics_ext
# os.environ["REDCAL_EXT"] = redcal_ext
# os.environ["NB_OUTDIR"] = nb_outdir
# os.environ["GOOD_STATUSES"] = good_statuses
In [3]:
# Use environment variables to figure out path to data
JD = os.environ['JULIANDATE']
data_path = os.environ['DATA_PATH']
ant_metrics_ext = os.environ['ANT_METRICS_EXT']
redcal_ext = os.environ['REDCAL_EXT']
nb_outdir = os.environ['NB_OUTDIR']
good_statuses = os.environ['GOOD_STATUSES']
print(f'JD = "{JD}"')
print(f'data_path = "{data_path}"')
print(f'ant_metrics_ext = "{ant_metrics_ext}"')
print(f'redcal_ext = "{redcal_ext}"')
print(f'nb_outdir = "{nb_outdir}"')
print(f'good_statuses = "{good_statuses}"')
JD = "2459832"
data_path = "/mnt/sn1/2459832"
ant_metrics_ext = ".ant_metrics.hdf5"
redcal_ext = ".known_good.omni.calfits"
nb_outdir = "/home/obs/src/H6C_Notebooks/_rtp_summary_"
good_statuses = "digital_ok,calibration_maintenance,calibration_triage,calibration_ok"
In [4]:
from astropy.time import Time
utc = Time(JD, format='jd').datetime
print(f'Date: {utc.month}-{utc.day}-{utc.year}')
Date: 9-9-2022
In [5]:
# Per-season options
def ant_to_report_url(ant):
    return f'https://htmlpreview.github.io/?https://github.com/HERA-Team/H6C_Notebooks/blob/main/antenna_report/antenna_{ant}_report.html'

Load Auto Metrics¶

In [6]:
use_auto_metrics = False

# find the auto_metrics file
glob_str = os.path.join(data_path, f'zen.{JD}*.auto_metrics.h5')
auto_metrics_file = sorted(glob.glob(glob_str))

# if it exists, load and extract relevant information
if len(auto_metrics_file) > 0:
    auto_metrics_file = auto_metrics_file[0]
    print(f'Found auto_metrics results file at {auto_metrics_file}.')
    
    auto_metrics = load_metric_file(auto_metrics_file)
    mean_round_modz_cut = auto_metrics['parameters']['mean_round_modz_cut']
    auto_ex_ants = auto_metrics['ex_ants']['r2_ex_ants']
    
    use_auto_metrics = True
else:
    print(f'No files found matching glob {glob_str}. Skipping auto_metrics.')
Found auto_metrics results file at /mnt/sn1/2459832/zen.2459832.25316.sum.auto_metrics.h5.

Load Ant Metrics¶

In [7]:
use_ant_metrics = False

# get a list of all ant_metrics files
glob_str = os.path.join(data_path, f'zen.{JD}.?????.sum{ant_metrics_ext}')
ant_metrics_files = sorted(glob.glob(glob_str))

# if they exist, load as many of them as possible
if len(ant_metrics_files) > 0:
    print(f'Found {len(ant_metrics_files)} ant_metrics files matching glob {glob_str}')
    ant_metrics_apriori_exants = {}
    ant_metrics_xants_dict = {}
    ant_metrics_dead_ants_dict = {}
    ant_metrics_crossed_ants_dict = {}
    ant_metrics_dead_metrics = {}
    ant_metrics_crossed_metrics = {}
    dead_cuts = {}
    crossed_cuts = {}
    for amf in ant_metrics_files:
        with h5py.File(amf, "r") as infile: # use h5py directly since it's much faster than load_metric_file
            # get out results for this file
            dead_cuts[amf] = infile['Metrics']['dead_ant_cut'][()]
            crossed_cuts[amf] = infile['Metrics']['cross_pol_cut'][()]
            xants = infile['Metrics']['xants'][:]
            dead_ants = infile['Metrics']['dead_ants'][:]
            crossed_ants = infile['Metrics']['crossed_ants'][:]        
            try:
                # look for ex_ants in history
                ex_ants_string = infile['Header']['history'][()].decode()
                ex_ants_string = ex_ants_string.split('--apriori_xants')[1]
                ex_ants_string = ex_ants_string.split('--')[0].strip()
            except:
                ex_ants_string = ''
                    
            # This only works for the new correlation-matrix-based ant_metrics
            if 'corr' in infile['Metrics']['final_metrics'] and 'corrXPol' in infile['Metrics']['final_metrics']:
                ant_metrics_dead_metrics[amf] = {eval(ant): infile['Metrics']['final_metrics']['corr'][ant][()]
                                                 for ant in infile['Metrics']['final_metrics']['corr']}
                ant_metrics_crossed_metrics[amf] = {eval(ant): infile['Metrics']['final_metrics']['corrXPol'][ant][()]
                                                    for ant in infile['Metrics']['final_metrics']['corrXPol']}                       
            else:
                raise(KeywordError)
        
        # organize results by file
        ant_metrics_xants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in xants]
        ant_metrics_dead_ants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in dead_ants]
        ant_metrics_crossed_ants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in crossed_ants]
        ant_metrics_apriori_exants[amf] = [int(ant) for ant in ex_ants_string.split()]
    
    dead_cut = np.median(list(dead_cuts.values()))
    crossed_cut = np.median(list(crossed_cuts.values()))
        
    use_ant_metrics = True
else:
    print(f'No files found matching glob {glob_str}. Skipping ant_metrics.')
Found 372 ant_metrics files matching glob /mnt/sn1/2459832/zen.2459832.?????.sum.ant_metrics.hdf5

Load chi^2 info from redcal¶

In [8]:
use_redcal = False
glob_str = os.path.join(data_path, f'zen.{JD}.?????.sum{redcal_ext}')

redcal_files = sorted(glob.glob(glob_str))
if len(redcal_files) > 0:
    print(f'Found {len(redcal_files)} ant_metrics files matching glob {glob_str}')
    post_redcal_ant_flags_dict = {}
    flagged_by_redcal_dict = {}
    cspa_med_dict = {}
    for cal in redcal_files:
        hc = io.HERACal(cal)
        _, flags, cspa, chisq = hc.read()
        cspa_med_dict[cal] = {ant: np.nanmedian(cspa[ant], axis=1) for ant in cspa}

        post_redcal_ant_flags_dict[cal] = {ant: np.all(flags[ant]) for ant in flags}
        # check history to distinguish antennas flagged going into redcal from ones flagged during redcal
        tossed_antenna_lines =  hc.history.replace('\n','').split('Throwing out antenna ')[1:]
        flagged_by_redcal_dict[cal] = sorted([int(line.split(' ')[0]) for line in tossed_antenna_lines])
        
    use_redcal = True
else:
    print(f'No files found matching glob {glob_str}. Skipping redcal chisq.')
No files found matching glob /mnt/sn1/2459832/zen.2459832.?????.sum.known_good.omni.calfits. Skipping redcal chisq.

Figure out some general properties¶

In [9]:
# Parse some general array properties, taking into account the fact that we might be missing some of the metrics
ants = []
pols = []
antpol_pairs = []

if use_auto_metrics:
    ants = sorted(set(bl[0] for bl in auto_metrics['modzs']['r2_shape_modzs']))
    pols = sorted(set(bl[2] for bl in auto_metrics['modzs']['r2_shape_modzs']))
if use_ant_metrics:
    antpol_pairs = sorted(set([antpol for dms in ant_metrics_dead_metrics.values() for antpol in dms.keys()]))
    antpols = sorted(set(antpol[1] for antpol in antpol_pairs))
    ants = sorted(set(antpol[0] for antpol in antpol_pairs) | set(ants))
    pols = sorted(set(utils.join_pol(ap, ap) for ap in antpols) | set(pols))
if use_redcal:
    antpol_pairs = sorted(set([ant for cspa in cspa_med_dict.values() for ant in cspa.keys()]) | set(antpol_pairs))
    antpols = sorted(set(antpol[1] for antpol in antpol_pairs))
    ants = sorted(set(antpol[0] for antpol in antpol_pairs) | set(ants))
    pols = sorted(set(utils.join_pol(ap, ap) for ap in antpols) | set(pols))

# Figure out remaining antennas not in data and also LST range
data_files = sorted(glob.glob(os.path.join(data_path, 'zen.*.sum.uvh5')))
hd = io.HERAData(data_files[0])
unused_ants = [ant for ant in hd.antpos if ant not in ants]    
hd_last = io.HERAData(data_files[-1])

Load a priori antenna statuses and node numbers¶

In [10]:
# try to load a priori antenna statusesm but fail gracefully if this doesn't work.
a_priori_statuses = {ant: 'Not Found' for ant in ants}
nodes = {ant: np.nan for ant in ants + unused_ants}
try:
    from hera_mc import cm_hookup

    # get node numbers
    hookup = cm_hookup.get_hookup('default')
    for ant_name in hookup:
        ant = int("".join(filter(str.isdigit, ant_name)))
        if ant in nodes:
            if hookup[ant_name].get_part_from_type('node')['E<ground'] is not None:
                nodes[ant] = int(hookup[ant_name].get_part_from_type('node')['E<ground'][1:])
    
    # get apriori antenna status
    for ant_name, data in hookup.items():
        ant = int("".join(filter(str.isdigit, ant_name)))
        if ant in a_priori_statuses:
            a_priori_statuses[ant] = data.apriori

except Exception as err:
    print(f'Could not load node numbers and a priori antenna statuses.\nEncountered {type(err)} with message: {err}')

Summarize auto metrics¶

In [11]:
if use_auto_metrics:
    # Parse modzs
    modzs_to_check = {'Shape': 'r2_shape_modzs', 'Power': 'r2_power_modzs', 
                      'Temporal Variability': 'r2_temp_var_modzs', 'Temporal Discontinuties': 'r2_temp_diff_modzs'}
    worst_metrics = []
    worst_zs = []
    all_modzs = {}
    binary_flags = {rationale: [] for rationale in modzs_to_check}

    for ant in ants:
        # parse modzs and figure out flag counts
        modzs = {f'{pol} {rationale}': auto_metrics['modzs'][dict_name][(ant, ant, pol)] 
                 for rationale, dict_name in modzs_to_check.items() for pol in pols}
        for pol in pols:
            for rationale, dict_name in modzs_to_check.items():
                binary_flags[rationale].append(auto_metrics['modzs'][dict_name][(ant, ant, pol)] > mean_round_modz_cut)

        # parse out all metrics for dataframe
        for k in modzs:
            col_label = k + ' Modified Z-Score'
            if col_label in all_modzs:
                all_modzs[col_label].append(modzs[k])
            else:
                all_modzs[col_label] = [modzs[k]]
                
    mean_round_modz_cut = auto_metrics['parameters']['mean_round_modz_cut']
else:
    mean_round_modz_cut = 0

Summarize ant metrics¶

In [12]:
if use_ant_metrics:
    a_priori_flag_frac = {ant: np.mean([ant in apxa for apxa in ant_metrics_apriori_exants.values()]) for ant in ants}
    dead_ant_frac = {ap: {ant: np.mean([(ant, ap) in das for das in ant_metrics_dead_ants_dict.values()])
                                 for ant in ants} for ap in antpols}
    crossed_ant_frac = {ant: np.mean([np.any([(ant, ap) in cas for ap in antpols])
                                      for cas in ant_metrics_crossed_ants_dict.values()]) for ant in ants}
    ant_metrics_xants_frac_by_antpol = {antpol: np.mean([antpol in amx for amx in ant_metrics_xants_dict.values()]) for antpol in antpol_pairs}
    ant_metrics_xants_frac_by_ant = {ant: np.mean([np.any([(ant, ap) in amx for ap in antpols])
                                     for amx in ant_metrics_xants_dict.values()]) for ant in ants}
    average_dead_metrics = {ap: {ant: np.nanmean([dm.get((ant, ap), np.nan) for dm in ant_metrics_dead_metrics.values()]) 
                                 for ant in ants} for ap in antpols}
    average_crossed_metrics = {ant: np.nanmean([cm.get((ant, ap), np.nan) for ap in antpols 
                                                for cm in ant_metrics_crossed_metrics.values()]) for ant in ants}
else:
    dead_cut = 0.4
    crossed_cut = 0.0

Summarize redcal chi^2 metrics¶

In [13]:
if use_redcal:
    cspa = {ant: np.nanmedian(np.hstack([cspa_med_dict[cal][ant] for cal in redcal_files])) for ant in antpol_pairs}
    redcal_prior_flag_frac = {ant: np.mean([np.any([afd[ant, ap] and not ant in flagged_by_redcal_dict[cal] for ap in antpols])
                                            for cal, afd in post_redcal_ant_flags_dict.items()]) for ant in ants}
    redcal_flagged_frac = {ant: np.mean([ant in fbr for fbr in flagged_by_redcal_dict.values()]) for ant in ants}

Get FEM switch states¶

In [14]:
HHautos = sorted(glob.glob(f"{data_path}/zen.{JD}.*.sum.autos.uvh5"))
diffautos = sorted(glob.glob(f"{data_path}/zen.{JD}.*.diff.autos.uvh5"))

try:
    db = mc.connect_to_mc_db(None)
    session = db.sessionmaker()
    startJD = float(HHautos[0].split('zen.')[1].split('.sum')[0])
    stopJD = float(HHautos[-1].split('zen.')[1].split('.sum')[0])
    startTime = Time(startJD,format='jd')
    stopTime = Time(stopJD,format='jd')
    res = session.get_antenna_status(starttime=startTime, stoptime=stopTime)
    fem_switches = {}
    if len(res) == 0:
        femState = None
    else:
        for antpol in res:
            fem_switches[(antpol.antenna_number, antpol.antenna_feed_pol)] = antpol.fem_switch
    femState = (max(set(list(fem_switches.values())), key = list(fem_switches.values()).count)) 
except Exception as e:
    print(e)
    femState = None
max() arg is an empty sequence

Find X-engine Failures¶

In [15]:
read_inds = [1, len(HHautos)//2, -2]
x_status = [1,1,1,1,1,1,1,1]
s = UVData()
s.read(HHautos[1])

nants = len(s.get_ants())
freqs = s.freq_array[0]*1e-6
nfreqs = len(freqs)

antCon = {a: None for a in ants}
rightAnts = []
for i in read_inds:
    s = UVData()
    d = UVData()
    s.read(HHautos[i])
    d.read(diffautos[i])
    for pol in [0,1]:
        sm = np.abs(s.data_array[:,0,:,pol])
        df = np.abs(d.data_array[:,0,:,pol])
        sm = np.r_[sm, np.nan + np.zeros((-len(sm) % nants,len(freqs)))]
        sm = np.nanmean(sm.reshape(-1,nants,nfreqs),axis=1)
        df = np.r_[df, np.nan + np.zeros((-len(df) % nants,len(freqs)))]
        df = np.nanmean(df.reshape(-1,nants,nfreqs),axis=1)

        evens = (sm + df)/2
        odds = (sm - df)/2
        rat = np.divide(evens,odds)
        rat = np.nan_to_num(rat)
        for xbox in range(0,8):
            xavg = np.nanmean(rat[:,xbox*192:(xbox+1)*192],axis=1)
            if np.nanmax(xavg)>1.5 or np.nanmin(xavg)<0.5:
                x_status[xbox] = 0
    for ant in ants:
        for pol in ["xx", "yy"]:
            if antCon[ant] is False:
                continue
            spectrum = s.get_data(ant, ant, pol)
            stdev = np.std(spectrum)
            med = np.median(np.abs(spectrum))
            if (femState == "load" or femState == 'noise') and 80000 < stdev <= 4000000 and antCon[ant] is not False:
                antCon[ant] = True
            elif femState == "antenna" and stdev > 500000 and med > 950000 and antCon[ant] is not False:
                antCon[ant] = True
            else:
                antCon[ant] = False
            if np.min(np.abs(spectrum)) < 100000:
                antCon[ant] = False
for ant in ants:
    if antCon[ant] is True:
        rightAnts.append(ant)
            
x_status_str = ''
for i,x in enumerate(x_status):
    if x==0:
        x_status_str += '\u274C '
    else:
        x_status_str += '\u2705 '

Build Overall Health DataFrame¶

In [16]:
def comma_sep_paragraph(vals, chars_per_line=40):
    outstrs = []
    for val in vals:
        if (len(outstrs) == 0) or (len(outstrs[-1]) > chars_per_line):
            outstrs.append(str(val))
        else:
            outstrs[-1] += ', ' + str(val)
    return ',<br>'.join(outstrs)
In [17]:
# Time data
to_show = {'JD': [JD]}
to_show['Date'] = f'{utc.month}-{utc.day}-{utc.year}'
to_show['LST Range'] = f'{hd.lsts[0] * 12 / np.pi:.3f} -- {hd_last.lsts[-1] * 12 / np.pi:.3f} hours'

# X-engine status
to_show['X-Engine Status'] = x_status_str

# Files
to_show['Number of Files'] = len(data_files)

# Antenna Calculations
to_show['Total Number of Antennas'] = len(ants)

to_show[' '] = ''
to_show['OPERATIONAL STATUS SUMMARY'] = ''

status_count = {status: 0 for status in status_colors}
for ant, status in a_priori_statuses.items():
    if status in status_count:
        status_count[status] = status_count[status] + 1
    else:
        status_count[status] = 1
to_show['Antenna A Priori Status Count'] = '<br>'.join([f'{status}: {status_count[status]}' for status in status_colors if status in status_count and status_count[status] > 0])

to_show['Commanded Signal Source'] = femState
to_show['Antennas in Commanded State'] = f'{len(rightAnts)} / {len(ants)} ({len(rightAnts) / len(ants):.1%})'

if use_ant_metrics:
    to_show['Cross-Polarized Antennas'] = ', '.join([str(ant) for ant in ants if (np.max([dead_ant_frac[ap][ant] for ap in antpols]) + crossed_ant_frac[ant] == 1) 
                                                                                 and (crossed_ant_frac[ant] > .5)])

# Node calculations
nodes_used = set([nodes[ant] for ant in ants if np.isfinite(nodes[ant])])
to_show['Total Number of Nodes'] = len(nodes_used)
if use_ant_metrics:
    node_off = {node: True for node in nodes_used}
    not_correlating = {node: True for node in nodes_used}
    for ant in ants:
        for ap in antpols:
            if np.isfinite(nodes[ant]):
                if np.isfinite(average_dead_metrics[ap][ant]):
                    node_off[nodes[ant]] = False
                if dead_ant_frac[ap][ant] < 1:
                    not_correlating[nodes[ant]] = False
    to_show['Nodes Registering 0s'] = ', '.join([f'N{n:02}' for n in sorted([node for node in node_off if node_off[node]])])
    to_show['Nodes Not Correlating'] = ', '.join([f'N{n:02}' for n in sorted([node for node in not_correlating if not_correlating[node] and not node_off[node]])])

# Pipeline calculations    
to_show['  '] = ''
to_show['NIGHTLY ANALYSIS SUMMARY'] = ''
    
all_flagged_ants = []
if use_ant_metrics:
    to_show['Ant Metrics Done?'] = '\u2705'
    ant_metrics_flagged_ants = [ant for ant in ants if ant_metrics_xants_frac_by_ant[ant] > 0]
    all_flagged_ants.extend(ant_metrics_flagged_ants)
    to_show['Ant Metrics Flagged Antennas'] = f'{len(ant_metrics_flagged_ants)} / {len(ants)} ({len(ant_metrics_flagged_ants) / len(ants):.1%})' 
else:
    to_show['Ant Metrics Done?'] = '\u274C'
if use_auto_metrics:
    to_show['Auto Metrics Done?'] = '\u2705'
    auto_metrics_flagged_ants = [ant for ant in ants if ant in auto_ex_ants]
    all_flagged_ants.extend(auto_metrics_flagged_ants)    
    to_show['Auto Metrics Flagged Antennas'] = f'{len(auto_metrics_flagged_ants)} / {len(ants)} ({len(auto_metrics_flagged_ants) / len(ants):.1%})' 
else:
    to_show['Auto Metrics Done?'] = '\u274C'
if use_redcal:
    to_show['Redcal Done?'] = '\u2705'    
    redcal_flagged_ants = [ant for ant in ants if redcal_flagged_frac[ant] > 0]
    all_flagged_ants.extend(redcal_flagged_ants)    
    to_show['Redcal Flagged Antennas'] = f'{len(redcal_flagged_ants)} / {len(ants)} ({len(redcal_flagged_ants) / len(ants):.1%})' 
else:
    to_show['Redcal Done?'] = '\u274C' 
to_show['Never Flagged Antennas'] = f'{len(ants) - len(set(all_flagged_ants))} / {len(ants)} ({(len(ants) - len(set(all_flagged_ants))) / len(ants):.1%})'

# Count bad antennas with good statuses and vice versa
n_apriori_good = len([ant for ant in ants if a_priori_statuses[ant] in good_statuses.split(',')])
apriori_good_flagged = []
aprior_bad_unflagged = []
for ant in ants:
    if ant in set(all_flagged_ants) and a_priori_statuses[ant] in good_statuses.split(','):
        apriori_good_flagged.append(ant)
    elif ant not in set(all_flagged_ants) and a_priori_statuses[ant] not in good_statuses.split(','):
        aprior_bad_unflagged.append(ant)
to_show['A Priori Good Antennas Flagged'] = f'{len(apriori_good_flagged)} / {n_apriori_good} total a priori good antennas:<br>' + \
                                            comma_sep_paragraph(apriori_good_flagged)
to_show['A Priori Bad Antennas Not Flagged'] = f'{len(aprior_bad_unflagged)} / {len(ants) - n_apriori_good} total a priori bad antennas:<br>' + \
                                            comma_sep_paragraph(aprior_bad_unflagged)

# Apply Styling
df = pd.DataFrame(to_show)
divider_cols = [df.columns.get_loc(col) for col in ['NIGHTLY ANALYSIS SUMMARY', 'OPERATIONAL STATUS SUMMARY']]
try:
    to_red_columns = [df.columns.get_loc(col) for col in ['Cross-Polarized Antennas', 'Nodes Registering 0s', 
                                                          'Nodes Not Correlating', 'A Priori Good Antennas Flagged']]
except:
    to_red_columns = []
def red_specific_cells(x):
    df1 = pd.DataFrame('', index=x.index, columns=x.columns)
    for col in to_red_columns:
        df1.iloc[col] = 'color: red'
    return df1

df = df.T
table = df.style.hide_columns().apply(red_specific_cells, axis=None)
for col in divider_cols:
    table = table.set_table_styles([{"selector":f"tr:nth-child({col+1})", "props": [("background-color", "black"), ("color", "white")]}], overwrite=False)

Table 1: Overall Array Health¶

In [18]:
HTML(table.render())
Out[18]:
JD 2459832
Date 9-9-2022
LST Range 18.754 -- 20.754 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 372
Total Number of Antennas 139
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 3
RF_maintenance: 32
RF_ok: 3
digital_maintenance: 3
digital_ok: 95
not_connected: 3
Commanded Signal Source None
Antennas in Commanded State 0 / 139 (0.0%)
Cross-Polarized Antennas
Total Number of Nodes 14
Nodes Registering 0s N18
Nodes Not Correlating N04
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 57 / 139 (41.0%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 89 / 139 (64.0%)
Redcal Done? ❌
Never Flagged Antennas 39 / 139 (28.1%)
A Priori Good Antennas Flagged 60 / 95 total a priori good antennas:
3, 7, 9, 10, 19, 20, 21, 29, 30, 31, 37, 38,
40, 41, 42, 45, 53, 54, 55, 56, 69, 71, 72,
73, 84, 86, 88, 91, 93, 94, 99, 101, 103, 105,
106, 107, 108, 118, 121, 122, 123, 128, 140,
141, 142, 144, 156, 158, 160, 161, 165, 167,
169, 170, 176, 177, 179, 181, 190, 191
A Priori Bad Antennas Not Flagged 4 / 44 total a priori bad antennas:
82, 90, 135, 138
In [19]:
# write to csv
outpath = os.path.join(nb_outdir, f'array_health_table_{JD}.csv')
print(f'Now saving Table 2 to a csv at {outpath}')
df.replace({'\u2705': 'Y'}, regex=True).replace({'\u274C': 'N'}, regex=True).replace({'<br>': ' '}, regex=True).to_csv(outpath)
Now saving Table 2 to a csv at /home/obs/src/H6C_Notebooks/_rtp_summary_/array_health_table_2459832.csv

Build DataFrame¶

In [20]:
# build dataframe
to_show = {'Ant': [f'<a href="{ant_to_report_url(ant)}" target="_blank">{ant}</a>' for ant in ants],
           'Node': [f'N{nodes[ant]:02}' for ant in ants], 
           'A Priori Status': [a_priori_statuses[ant] for ant in ants]}
           #'Worst Metric': worst_metrics, 'Worst Modified Z-Score': worst_zs}
df = pd.DataFrame(to_show)

# create bar chart columns for flagging percentages:
bar_cols = {}
if use_auto_metrics:
    bar_cols['Auto Metrics Flags'] = [float(ant in auto_ex_ants) for ant in ants]
if use_ant_metrics:
    if np.sum(list(a_priori_flag_frac.values())) > 0:  # only include this col if there are any a priori flags
        bar_cols['A Priori Flag Fraction in Ant Metrics'] = [a_priori_flag_frac[ant] for ant in ants]
    for ap in antpols:
        bar_cols[f'Dead Fraction in Ant Metrics ({ap})'] = [dead_ant_frac[ap][ant] for ant in ants]
    bar_cols['Crossed Fraction in Ant Metrics'] = [crossed_ant_frac[ant] for ant in ants]
if use_redcal:
    bar_cols['Flag Fraction Before Redcal'] = [redcal_prior_flag_frac[ant] for ant in ants]
    bar_cols['Flagged By Redcal chi^2 Fraction'] = [redcal_flagged_frac[ant] for ant in ants]  
for col in bar_cols:
    df[col] = bar_cols[col]

# add auto_metrics
if use_auto_metrics:
    for label, modz in all_modzs.items():
        df[label] = modz
z_score_cols = [col for col in df.columns if 'Modified Z-Score' in col]        
        
# add ant_metrics
ant_metrics_cols = {}
if use_ant_metrics:
    for ap in antpols:
        ant_metrics_cols[f'Average Dead Ant Metric ({ap})'] = [average_dead_metrics[ap][ant] for ant in ants]
    ant_metrics_cols['Average Crossed Ant Metric'] = [average_crossed_metrics[ant] for ant in ants]
    for col in ant_metrics_cols:
        df[col] = ant_metrics_cols[col]   

# add redcal chisq
redcal_cols = []
if use_redcal:
    for ap in antpols:
        col_title = f'Median chi^2 Per Antenna ({ap})'
        df[col_title] = [cspa[ant, ap] for ant in ants]
        redcal_cols.append(col_title)

# sort by node number and then by antenna number within nodes
df.sort_values(['Node', 'Ant'], ascending=True)

# style dataframe
table = df.style.hide_index()\
          .applymap(lambda val: f'background-color: {status_colors[val]}' if val in status_colors else '', subset=['A Priori Status']) \
          .background_gradient(cmap='viridis', vmax=mean_round_modz_cut * 3, vmin=0, axis=None, subset=z_score_cols) \
          .background_gradient(cmap='bwr_r', vmin=dead_cut-.25, vmax=dead_cut+.25, axis=0, subset=list([col for col in ant_metrics_cols if 'dead' in col.lower()])) \
          .background_gradient(cmap='bwr_r', vmin=crossed_cut-.25, vmax=crossed_cut+.25, axis=0, subset=list([col for col in ant_metrics_cols if 'crossed' in col.lower()])) \
          .background_gradient(cmap='plasma', vmax=4, vmin=1, axis=None, subset=redcal_cols) \
          .applymap(lambda val: 'font-weight: bold' if val < dead_cut else '', subset=list([col for col in ant_metrics_cols if 'dead' in col.lower()])) \
          .applymap(lambda val: 'font-weight: bold' if val < crossed_cut else '', subset=list([col for col in ant_metrics_cols if 'crossed' in col.lower()])) \
          .applymap(lambda val: 'font-weight: bold' if val > mean_round_modz_cut else '', subset=z_score_cols) \
          .applymap(lambda val: 'color: red' if val > mean_round_modz_cut else '', subset=z_score_cols) \
          .bar(subset=list(bar_cols.keys()), vmin=0, vmax=1) \
          .format({col: '{:,.4f}'.format for col in z_score_cols}) \
          .format({col: '{:,.4f}'.format for col in ant_metrics_cols}) \
          .format({col: '{:,.2%}'.format for col in bar_cols}) \
          .applymap(lambda val: 'font-weight: bold', subset=['Ant']) \
          .set_table_styles([dict(selector="th",props=[('max-width', f'70pt')])])

Table 2: RTP Per-Antenna Metrics Summary Table¶

This admittedly very busy table incorporates summary information about all antennas in the array. Its columns depend on what information is available when the notebook is run (i.e. whether auto_metrics, ant_metrics, and/or redcal is done). These can be divided into 5 sections:

Basic Antenna Info: antenna number, node, and its a priori status.

Flag Fractions: Fraction of the night that an antenna was flagged for various reasons. Note that auto_metrics flags antennas for the whole night, so it'll be 0% or 100%.

auto_metrics Details: If auto_metrics is included, this section shows the modified Z-score signifying how much of an outlier each antenna and polarization is in each of four categories: bandpass shape, overall power, temporal variability, and temporal discontinuities. Bold red text indicates that this is a reason for flagging the antenna. It is reproduced from the auto_metrics_inspect.ipynb nightly notebook, so check that out for more details on the precise metrics.

ant_metrics Details: If ant_metrics is included, this section shows the average correlation-based metrics for antennas over the whole night. Low "dead ant" metrics (nominally below 0.4) indicate antennas not correlating with the rest of the array. Negative "crossed ant" metrics indicate antennas that show stronger correlations in their cross-pols than their same-pols, indicating that the two polarizations are probably swapped. Bold text indicates that the average is below the threshold for flagging.

redcal chi^2 Details: If redcal is included, this shows the median chi^2 per antenna. This would be 1 in an ideal array. Antennas are thrown out when they they are outliers in their median chi^2, usually greater than 4-sigma outliers in modified Z-score.

In [21]:
HTML(table.render())
Out[21]:
Ant Node A Priori Status Auto Metrics Flags Dead Fraction in Ant Metrics (Jee) Dead Fraction in Ant Metrics (Jnn) Crossed Fraction in Ant Metrics ee Shape Modified Z-Score nn Shape Modified Z-Score ee Power Modified Z-Score nn Power Modified Z-Score ee Temporal Variability Modified Z-Score nn Temporal Variability Modified Z-Score ee Temporal Discontinuties Modified Z-Score nn Temporal Discontinuties Modified Z-Score Average Dead Ant Metric (Jee) Average Dead Ant Metric (Jnn) Average Crossed Ant Metric
3 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 4.805642 -0.890584 -0.819767 -0.865884 -0.296672 -0.038974 -0.485155 1.196451 0.792909 0.499739 0.606156
4 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.713393 7.652966 0.352123 0.738537 -0.543284 1.357620 0.563172 -0.738605 0.806828 0.499168 0.614114
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.004625 -0.134983 0.801247 2.395085 -1.084607 1.391563 -0.203264 -1.272611 0.809931 0.517612 0.610504
7 N02 digital_ok 100.00% 0.00% 16.13% 0.00% -0.942873 -1.117721 -0.201153 -0.651515 -0.456023 -0.899052 0.795148 8.134188 0.747778 0.435631 0.576052
8 N02 RF_maintenance 100.00% 0.00% 29.57% 0.00% 10.997295 12.606926 16.046036 16.257564 8.473974 8.221652 1.589203 -0.851799 0.745484 0.417161 0.578235
9 N02 digital_ok 0.00% 0.00% 29.57% 0.00% -0.319487 -1.875919 -0.801178 -0.369865 -0.364162 -0.562153 -0.316461 2.177941 0.753885 0.428709 0.586857
10 N02 digital_ok 0.00% 0.00% 29.57% 0.00% 1.262231 -1.068565 -0.773343 -0.360292 0.354087 0.847330 1.350865 1.986729 0.744226 0.418075 0.588228
15 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.115259 0.458217 -1.095291 -1.047103 -0.626712 -1.274499 -0.360358 -0.168133 0.806829 0.508409 0.610304
16 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.972361 -1.280085 -0.246997 -1.063764 0.419379 1.180353 2.708424 -0.091008 0.808447 0.513633 0.604635
17 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.179704 0.351964 0.240859 0.204972 -0.384923 -0.807943 3.347086 0.640909 0.809545 0.518182 0.608474
18 N01 RF_maintenance 100.00% 0.00% 100.00% 0.00% 8.108660 13.218214 2.559381 1.257628 1.172385 3.640456 11.594903 30.339676 0.798010 0.310124 0.643715
19 N02 digital_ok 100.00% 0.00% 16.13% 0.00% -1.934205 -1.345005 1.274581 0.287055 1.052994 1.451497 7.412606 10.623693 0.748071 0.435948 0.571331
20 N02 digital_ok 0.00% 0.00% 29.57% 0.00% -2.747258 2.018756 -0.560047 -0.230169 -0.963316 0.515650 0.181978 -0.937257 0.757092 0.423385 0.580005
21 N02 digital_ok 0.00% 0.00% 29.57% 0.00% 1.642751 -1.597406 0.376758 0.938820 0.323018 1.679581 1.995452 3.501548 0.748140 0.420998 0.580743
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 31.983481 35.228902 25.165381 26.003809 13.836966 11.574374 3.489348 1.912456 0.036576 0.039901 0.002119
28 N01 RF_maintenance 100.00% 48.39% 100.00% 0.00% 22.294078 43.439170 -0.033139 1.136467 13.338306 12.908492 8.189309 27.155461 0.395754 0.154497 0.281713
29 N01 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
30 N01 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
31 N02 digital_ok 100.00% 0.00% 5.38% 0.00% 1.051284 -1.722033 -0.958989 -1.111017 -0.016086 5.618473 2.850470 2.567895 0.759870 0.444826 0.575815
32 N02 RF_maintenance 100.00% 0.00% 67.20% 0.00% 51.419364 44.286418 1.280876 0.784676 2.330268 1.320983 1.204436 -0.497536 0.649188 0.395007 0.389538
33 N02 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.572382 14.612434 1.668769 0.836484 -0.866316 2.077490 0.469892 25.721668 0.746267 0.280050 0.620802
36 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 16.254411 11.756293 -0.202944 -0.441096 0.145136 -0.042105 -0.208456 1.021058 0.808438 0.521630 0.583956
37 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 1.010508 1.032189 -0.866199 -1.050903 -1.125110 -0.917545 0.287852 8.918733 0.815699 0.534266 0.581619
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.245414 -1.000321 -1.074770 -1.048223 0.671174 1.725500 6.790422 2.467953 0.813709 0.537951 0.584810
40 N04 digital_ok 0.00% 100.00% 100.00% 0.00% 0.461329 -0.467749 -0.979618 -0.816154 -0.445106 -0.480163 -0.386682 -0.858861 0.087962 0.095843 0.018954
41 N04 digital_ok 0.00% 100.00% 100.00% 0.00% 0.139601 -0.417615 1.091992 0.387480 3.701201 -0.694506 -0.486483 -0.643479 0.051727 0.084203 0.013047
42 N04 digital_ok 0.00% 100.00% 100.00% 0.00% -0.647750 1.618223 0.616022 0.496619 -0.649778 -0.917434 0.017720 -0.005353 0.093965 0.095577 0.022445
45 N05 digital_ok 100.00% 0.00% 0.00% 0.00% 0.026876 0.413645 -1.092850 0.429003 0.883085 2.109787 -0.134458 17.670046 0.811865 0.498168 0.608881
46 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -1.703101 -0.893510 0.230529 -0.874099 0.782583 -0.738320 0.409430 1.586476 0.812993 0.492307 0.617082
50 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 20.920683 4.925897 -0.300929 1.380104 1.433052 -0.587517 0.934782 -0.930892 0.765450 0.534765 0.516152
51 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 2.065912 3.811513 -0.751726 0.252051 -0.228549 2.350991 0.111361 0.979445 0.811166 0.554277 0.562372
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 13.189805 10.735482 0.194753 -0.298396 3.616832 -0.860846 1.382069 0.149262 0.817173 0.553165 0.565227
53 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 2.980860 2.573658 -0.952767 0.060579 -1.348331 -0.710867 2.439495 6.805370 0.811792 0.558321 0.570786
54 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 1.596226 11.433258 0.992896 -0.579345 0.533210 9.220807 0.789468 1.014506 0.092629 0.092461 0.018723
55 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 3.118907 2.261657 0.539637 0.112830 9.350214 -0.994020 6.729819 -0.559940 0.070147 0.068133 0.007676
56 N04 digital_ok 0.00% 100.00% 100.00% 0.00% -1.060033 1.318273 0.862013 0.921620 -0.811100 2.890574 -0.252047 1.063588 0.068768 0.065877 0.007225
57 N04 RF_maintenance 100.00% 100.00% 100.00% 0.00% 52.385012 -0.621665 7.804106 1.726837 9.472987 -0.256581 6.409423 0.898648 0.115788 0.084275 0.018697
65 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 2.451882 0.440759 1.640359 0.481415 1.902845 0.431243 0.434365 -0.246724 0.812721 0.539330 0.578841
66 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 1.881605 1.119455 0.093297 0.313249 1.736729 0.427030 -0.450379 0.372458 0.814285 0.559865 0.556316
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -1.007806 -1.372969 -0.236320 -1.090767 1.470121 -0.612093 0.632418 3.386544 0.814727 0.571846 0.545266
68 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 1.755629 0.984665 1.895252 0.435833 1.917805 2.253015 0.005353 2.261437 0.809140 0.569962 0.546554
69 N04 digital_ok 0.00% 100.00% 100.00% 0.00% 0.806418 -1.454738 0.064950 -0.089935 0.845602 1.671166 -0.219568 2.432565 0.103171 0.095797 0.025574
70 N04 RF_maintenance 100.00% 100.00% 100.00% 0.00% 11.622349 -1.751379 1.982080 -0.870516 3.747527 3.292810 1.244831 4.685262 0.077915 0.078935 0.012339
71 N04 digital_ok 0.00% 100.00% 100.00% 0.00% 0.301393 -0.056304 -0.793682 -0.530420 -0.378915 -0.941096 -0.274729 -0.418640 0.086907 0.083367 0.014719
72 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 5.257168 -0.680048 -0.821762 0.973286 0.145441 0.925396 2.774753 -0.971438 0.096997 0.083042 0.015088
73 N05 digital_ok 100.00% 100.00% 0.00% 0.00% 29.718369 -0.594454 24.653983 0.296471 13.593285 0.590908 1.313026 0.896144 0.034165 0.526967 0.330161
81 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.267862 0.505093 -0.775543 2.291415 -0.639932 -0.218021 -0.058522 -1.148724 0.803235 0.531808 0.567044
82 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 3.864158 0.167563 0.840519 0.162011 1.371869 -0.939349 -0.199279 -1.014853 0.811480 0.549174 0.566313
83 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 1.099146 1.273175 1.315937 3.051195 -0.651990 1.157724 -0.704653 -1.115100 0.814850 0.575936 0.546525
84 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 14.959624 16.437997 0.972498 -0.062260 -1.461714 3.593770 0.099741 2.463329 0.817607 0.580605 0.539754
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 0.147073 -0.054670 -0.919114 -0.805396 0.080354 -1.439282 -0.445875 -1.108229 0.807447 0.578079 0.556480
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.612611 7.248257 1.522499 -0.539403 10.066117 -0.787232 0.657750 -0.101843 0.808579 0.544194 0.562556
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 17.427273 17.035288 3.338683 0.485075 35.611650 0.134942 34.676322 4.336840 0.751318 0.572420 0.502411
88 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 17.015783 14.247318 19.431386 17.094088 11.940258 6.816889 0.007785 -0.212486 0.777511 0.542959 0.572016
90 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.135991 0.356198 1.492901 2.075153 -1.316095 -0.167997 0.233548 0.660798 0.806341 0.532126 0.592563
91 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 13.511403 15.826799 17.586067 17.978579 9.652962 8.773463 -0.195817 0.362504 0.795540 0.515027 0.596422
92 N10 RF_maintenance 100.00% 100.00% 100.00% 0.00% 64.812401 85.600541 1.783631 3.192192 15.400782 24.331988 2.411606 14.371447 0.315399 0.217868 0.150512
93 N10 digital_ok 100.00% 0.00% 0.00% 0.00% -0.020084 -0.352777 1.853802 -0.268932 6.179042 -0.376405 4.603769 -0.924084 0.742566 0.444905 0.562816
94 N10 digital_ok 100.00% 0.00% 0.00% 0.00% -0.858645 -2.482219 -1.112090 -0.579565 0.975822 2.711670 1.641482 8.940240 0.743283 0.433951 0.573096
98 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 0.288022 1.047350 0.550868 1.343001 0.456007 0.877177 0.128436 1.260716 0.797188 0.516040 0.579665
99 N07 digital_ok 100.00% 0.00% 0.00% 0.00% 11.044924 0.648783 1.988090 0.327126 0.043554 5.283445 2.557328 -0.705514 0.810177 0.545881 0.564288
100 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.342834 -0.634211 -0.530266 -0.152394 -0.027911 -0.433469 -0.099519 -0.361538 0.813112 0.558751 0.563056
101 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 15.097577 15.626012 2.646290 1.019152 -0.081025 -1.159258 6.617130 -0.379930 0.822795 0.578496 0.554735
102 N08 RF_maintenance 100.00% 0.00% 77.96% 0.00% 8.945616 9.742282 28.758989 30.997029 539.661111 800.459223 6596.469809 6469.589375 0.724036 0.385234 0.556838
103 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 6.556263 15.750194 -0.787001 -0.255394 1.773840 2.787740 -0.107355 -0.791253 0.817382 0.585781 0.552573
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 12.809707 118.484794 -0.349476 9.425889 2.817691 0.822321 0.304405 -0.553024 0.821689 0.570970 0.581521
105 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 1.948954 5.587118 7.670534 11.106371 1.384351 2.571353 -0.625767 0.205783 0.819578 0.572998 0.569377
106 N09 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
107 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 7.121948 4.861614 8.856584 5.482929 1.492650 2.750113 0.342181 4.301728 0.820189 0.554531 0.576705
108 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 9.742275 6.560330 13.965514 0.478123 16.860856 -0.682707 2.617190 -0.365023 0.711645 0.547482 0.535704
109 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.097921 0.409664 0.042781 0.399700 1.336038 -0.686722 2.682357 0.549105 0.747288 0.470664 0.555252
110 N10 RF_maintenance 100.00% 0.00% 37.63% 0.00% 59.290589 42.000749 1.609925 0.700233 2.576981 4.728266 1.768138 13.422639 0.653993 0.404891 0.392314
111 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.124125 0.482918 -1.041207 0.335717 0.027911 1.371464 -0.125581 3.264897 0.748773 0.451461 0.561166
112 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -1.243505 -0.497608 -0.852050 -0.318049 -0.441135 0.621008 -0.337279 -1.009985 0.739116 0.439137 0.567907
116 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 0.355467 3.221820 -0.971918 -0.662414 1.917438 -1.051050 0.268132 -0.874283 0.805626 0.519374 0.586232
117 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 1.053550 0.660086 3.441466 3.568242 1.142015 -0.812564 -0.934431 -1.358033 0.813803 0.542959 0.577307
118 N07 digital_ok 100.00% 0.00% 100.00% 0.00% 2.743131 39.420295 1.744922 22.356034 0.949944 12.477860 1.071661 -0.162268 0.818528 0.049613 0.609283
119 N07 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.066795 0.782338 6.897222 0.025826 1.012278 0.386303 -1.142903 -0.959381 0.827239 0.560731 0.573710
120 N08 RF_maintenance 100.00% 5.38% 100.00% 0.00% 26.538381 53.136457 0.098717 29.480536 10.153191 12.006507 0.988668 5.820736 0.450014 0.044562 0.351346
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 4.437166 8.467776 -0.903078 2.201983 -0.768391 1.730059 33.628889 15.058066 0.822809 0.585748 0.550847
122 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 13.868050 10.670390 0.892009 0.263279 1.095277 -0.162652 -0.422933 -0.936179 0.827368 0.582640 0.560969
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 12.322598 15.018062 0.487739 1.597312 -0.642380 1.046899 0.778949 -0.368405 0.820230 0.582609 0.558241
125 N09 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
126 N09 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
127 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -0.577828 -0.261439 0.019299 -0.431933 2.452208 0.521991 -0.031978 0.890566 0.746765 0.480919 0.553014
128 N10 digital_ok 100.00% 0.00% 0.00% 0.00% -1.852873 4.637942 -0.846238 0.095282 0.196134 2.705335 0.442398 -0.589073 0.748801 0.473084 0.552529
129 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -1.173483 -1.762398 0.446441 0.374382 -0.286178 0.239944 -0.688183 -0.917983 0.748684 0.463226 0.557143
130 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.139973 0.011103 -0.354455 0.884986 0.637927 1.314835 0.422310 3.081987 0.737704 0.442619 0.559971
135 N12 digital_maintenance 0.00% 0.00% 0.00% 0.00% -1.274468 -0.166524 -1.091725 -0.631776 0.161877 -0.126737 0.689732 -0.279811 0.739523 0.458771 0.547051
136 N12 digital_maintenance 100.00% 0.00% 0.00% 0.00% 2.151939 16.872246 -1.007059 -0.315165 1.460985 0.892365 1.867770 1.748974 0.739020 0.444756 0.528632
137 N07 RF_maintenance 100.00% 0.00% 0.00% 0.00% 6.393076 0.466526 10.500774 4.843067 5.829039 4.505292 -0.334483 0.059918 0.816053 0.544931 0.579541
138 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.055082 -0.757047 1.881272 0.333327 -1.586033 0.294947 1.709772 -1.031858 0.813867 0.548539 0.577366
140 N13 digital_ok 100.00% 100.00% 100.00% 0.00% 28.540762 33.669358 24.503432 26.026191 13.719541 11.561816 0.907147 0.660228 0.038178 0.039318 0.000443
141 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 2.649230 5.773857 2.155520 6.165710 -0.113652 0.214608 0.955313 17.447285 0.816067 0.542794 0.570379
142 N13 digital_ok 100.00% 0.00% 100.00% 0.00% 37.453153 41.349913 0.514366 26.218012 14.706527 11.594013 4.059624 1.908979 0.459285 0.039887 0.292931
143 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.208412 -1.230586 0.892922 -0.403340 0.533688 -0.662260 -0.081521 -1.217264 0.812439 0.575142 0.555145
144 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -2.215628 -1.333906 1.171136 0.125909 -0.950184 -0.855247 0.484875 10.801160 0.820675 0.567878 0.571965
145 N14 RF_maintenance 100.00% 100.00% 100.00% 0.00% 32.719707 36.051376 25.373934 26.502639 14.000491 11.681720 2.629450 3.708079 0.033781 0.033432 -0.000142
150 N15 RF_maintenance 100.00% 100.00% 100.00% 0.00% 34.817844 38.454380 25.334217 27.089679 14.094390 11.804120 3.258747 3.356019 0.046472 0.046228 0.000573
155 N12 digital_maintenance 100.00% 100.00% 100.00% 0.00% 30.102733 31.610276 24.548538 25.748616 13.830607 13.647028 3.139416 4.463874 0.040164 0.039338 0.001507
156 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 0.849687 0.351395 0.435954 0.001946 -0.701442 -0.381714 3.274651 10.051129 0.753195 0.454241 0.552324
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% -0.830340 -0.439740 -0.765571 1.817392 1.618646 0.274732 0.844800 0.764062 0.745827 0.472224 0.542945
158 N12 digital_ok 100.00% 100.00% 0.00% 0.00% 30.312127 -2.592428 25.241887 -1.088267 14.115732 -0.590575 1.146264 1.502837 0.036374 0.482653 0.295992
160 N13 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.969164 61.806844 -0.249408 1.793948 -0.130133 1.157305 0.119545 -0.866670 0.810361 0.451025 0.554838
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.311813 0.197591 -1.009184 -0.991860 1.852178 0.471339 0.068956 -0.523801 0.816066 0.562026 0.575822
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.523124 -0.688895 -0.551055 -0.868038 -1.557011 0.632228 -0.334033 2.154181 0.812864 0.563588 0.567543
164 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.965279 -1.508570 -1.159467 -0.504167 -1.083442 -0.162307 0.393753 1.598992 0.813578 0.556953 0.576457
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 0.034609 2.167148 5.249283 -1.005023 0.528250 -1.067042 0.836580 -0.392201 0.814463 0.555273 0.574794
166 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% 27.910167 0.814955 0.214942 0.869797 9.912954 5.166901 18.406995 18.636143 0.734538 0.537687 0.503573
167 N15 digital_ok 100.00% 0.00% 2.69% 0.00% 29.137724 28.373581 15.377111 16.271672 10.387213 8.893505 1.540194 6.576261 0.691157 0.420606 0.462984
168 N15 RF_maintenance 100.00% 0.00% 0.00% 0.00% 11.738787 16.646965 16.074557 18.136689 9.220975 9.140040 -1.430201 -0.098289 0.800956 0.505222 0.592019
169 N15 digital_ok 100.00% 0.00% 0.00% 0.00% 14.895902 15.310444 18.004373 17.092881 10.535737 9.023629 -0.517313 -0.442255 0.797605 0.492885 0.603754
170 N15 digital_ok 100.00% 0.00% 0.00% 0.00% 15.240879 12.434884 18.178340 16.187023 10.937354 7.110400 -0.289237 -0.271709 0.792533 0.497992 0.604528
176 N12 digital_ok 0.00% 0.00% 2.69% 0.00% 0.811136 -0.847920 -1.069357 -0.342776 -0.614230 0.394954 -0.515027 -0.061096 0.749315 0.432096 0.572857
177 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 0.559973 0.251500 0.594607 2.116011 -0.108121 1.010696 0.015713 5.146140 0.742564 0.439689 0.556327
178 N12 digital_ok 0.00% 0.00% 0.00% 0.00% -1.074487 -1.693622 0.042502 -0.798017 -0.216500 1.565360 0.073033 -0.790417 0.739534 0.461998 0.550184
179 N12 digital_ok 100.00% 0.00% 0.00% 0.00% -0.195758 0.133129 -1.055984 -0.127496 3.396897 -1.190882 7.094316 -0.550181 0.740874 0.469646 0.554967
180 N13 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
181 N13 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
182 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 11.108815 8.303147 16.172813 14.614133 8.018944 0.176445 -1.288315 21.452844 0.804350 0.470877 0.604518
183 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -2.821035 -1.728960 -0.073893 -1.100906 -0.660366 0.952570 -0.419867 2.805222 0.809129 0.543580 0.585303
184 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.004625 -0.512906 -0.110757 0.142352 -0.911517 -0.628563 0.793736 -0.719936 0.806418 0.543183 0.577254
185 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 1.753599 0.054326 0.686567 0.256512 -0.499348 -1.352254 3.518121 -0.938957 0.811402 0.539310 0.585749
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.186267 -0.449840 2.670697 1.415567 2.902089 -0.328982 3.322219 -0.505167 0.801743 0.528852 0.585780
187 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.252834 0.029844 -0.375923 -0.019299 -0.554038 -0.630408 3.264376 1.574769 0.803506 0.534915 0.583805
189 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 3.753033 3.531793 -0.206215 0.631335 -0.175739 3.124388 0.474914 2.781092 0.800060 0.503929 0.607761
190 N15 digital_ok 100.00% 0.00% 100.00% 0.00% 84.540198 39.737760 3.150667 26.496157 8.663956 11.783088 21.056259 2.743346 0.622478 0.043129 0.494284
191 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -1.138353 0.762635 -1.039365 1.415916 0.422031 -0.467818 1.021648 6.108255 0.808249 0.492490 0.630559
203 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
220 N18 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
221 N18 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
222 N18 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
320 N03 dish_maintenance 100.00% 100.00% 100.00% 0.00% 40.521455 37.819743 16.563334 17.022129 13.558124 11.479568 6.056591 3.028863 0.052643 0.048172 0.003969
321 N02 not_connected 100.00% 0.00% 94.09% 0.00% 4.126250 2.283303 10.056158 8.859412 3.112359 2.169286 2.780778 2.436118 0.712977 0.328308 0.601060
323 N02 not_connected 100.00% 0.00% 96.77% 0.00% 37.953678 6.302466 0.683275 12.230396 4.653159 2.646106 4.850030 -0.916865 0.529778 0.312410 0.427062
324 N04 not_connected 100.00% 100.00% 100.00% 0.00% 9.181772 4.862696 13.755897 7.963718 3.862643 1.076854 0.147386 -0.768979 0.114940 0.083565 0.062163
329 N12 dish_maintenance 100.00% 0.00% 86.02% 0.00% 13.136093 1.790951 1.190784 8.122777 1.763219 0.654915 1.912595 -1.304542 0.643888 0.342368 0.533193
333 N12 dish_maintenance 100.00% 0.00% 94.09% 0.00% 11.461243 2.978659 0.852198 7.615543 1.993560 1.006801 3.343714 -0.500974 0.634236 0.331015 0.530139
In [22]:
# print ex_ants for easy copy-pasting to YAML file
proposed_ex_ants = [ant for i, ant in enumerate(ants) if np.any([col[i] > 0 for col in bar_cols.values()])]
print('ex_ants: [' + ", ".join(str(ant) for ant in proposed_ex_ants) + ']')
print(f'\nunflagged_ants: [{", ".join([str(ant) for ant in ants if ant not in proposed_ex_ants])}]')
# "golden" means no flags and good a priori status
golden_ants = ", ".join([str(ant) for ant in ants if ((ant not in proposed_ex_ants) and (a_priori_statuses[ant] in good_statuses.split(',')))])
print(f'\ngolden_ants: [{golden_ants}]')
ex_ants: [3, 4, 7, 8, 9, 10, 18, 19, 20, 21, 27, 28, 29, 30, 31, 32, 33, 36, 37, 38, 40, 41, 42, 45, 50, 52, 53, 54, 55, 56, 57, 69, 70, 71, 72, 73, 84, 86, 87, 88, 91, 92, 93, 94, 99, 101, 102, 103, 104, 105, 106, 107, 108, 110, 118, 119, 120, 121, 122, 123, 125, 126, 128, 136, 137, 140, 141, 142, 144, 145, 150, 155, 156, 158, 160, 161, 165, 166, 167, 168, 169, 170, 176, 177, 179, 180, 181, 182, 190, 191, 203, 220, 221, 222, 320, 321, 323, 324, 329, 333]

unflagged_ants: [5, 15, 16, 17, 46, 51, 65, 66, 67, 68, 81, 82, 83, 85, 90, 98, 100, 109, 111, 112, 116, 117, 127, 129, 130, 135, 138, 143, 157, 162, 163, 164, 178, 183, 184, 185, 186, 187, 189]

golden_ants: [5, 15, 16, 17, 46, 51, 65, 66, 67, 68, 81, 83, 85, 98, 100, 109, 111, 112, 116, 117, 127, 129, 130, 143, 157, 162, 163, 164, 178, 183, 184, 185, 186, 187, 189]
In [23]:
# write to csv
outpath = os.path.join(nb_outdir, f'rtp_summary_table_{JD}.csv')
print(f'Now saving Table 2 to a csv at {outpath}')
df.to_csv(outpath)
Now saving Table 2 to a csv at /home/obs/src/H6C_Notebooks/_rtp_summary_/rtp_summary_table_2459832.csv
In [24]:
# Load antenna positions
data_list = sorted(glob.glob(os.path.join(data_path, f'zen.{JD}.?????.sum.uvh5')))
hd = io.HERAData(data_list[len(data_list) // 2])

# Figure out where to draw the nodes
node_centers = {}
for node in sorted(set(list(nodes.values()))):
    if np.isfinite(node):
        this_node_ants = [ant for ant in ants + unused_ants if nodes[ant] == node]
        if len(this_node_ants) == 1:
            # put the node label just to the west of the lone antenna 
            node_centers[node] = hd.antpos[ant][node] + np.array([-14.6 / 2, 0, 0])
        else:
            # put the node label between the two antennas closest to the node center
            node_centers[node] = np.mean([hd.antpos[ant] for ant in this_node_ants], axis=0)
            closest_two_pos = sorted([hd.antpos[ant] for ant in this_node_ants], 
                                     key=lambda pos: np.linalg.norm(pos - node_centers[node]))[0:2]
            node_centers[node] = np.mean(closest_two_pos, axis=0)
In [25]:
def Plot_Array(ants, unused_ants, outriggers):
    plt.figure(figsize=(16,16))
    
    plt.scatter(np.array([hd.antpos[ant][0] for ant in hd.data_ants if ant in ants]), 
                np.array([hd.antpos[ant][1] for ant in hd.data_ants if ant in ants]), c='w', s=0)

    # connect every antenna to their node
    for ant in ants:
        if nodes[ant] in node_centers:
            plt.plot([hd.antpos[ant][0], node_centers[nodes[ant]][0]], 
                     [hd.antpos[ant][1], node_centers[nodes[ant]][1]], 'k', zorder=0)

    rc_color = '#0000ff'
    antm_color = '#ffa500'
    autom_color = '#ff1493'

    # Plot 
    unflagged_ants = []
    for i, ant in enumerate(ants):
        ant_has_flag = False
        # plot large blue annuli for redcal flags
        if use_redcal:
            if redcal_flagged_frac[ant] > 0:
                ant_has_flag = True
                plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=7 * (2 - 1 * float(not outriggers)), fill=True, lw=0,
                                                color=rc_color, alpha=redcal_flagged_frac[ant]))
                plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=6 * (2 - 1 * float(not outriggers)), fill=True, color='w'))
        
        # plot medium green annuli for ant_metrics flags
        if use_ant_metrics: 
            if ant_metrics_xants_frac_by_ant[ant] > 0:
                ant_has_flag = True
                plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=6 * (2 - 1 * float(not outriggers)), fill=True, lw=0,
                                                color=antm_color, alpha=ant_metrics_xants_frac_by_ant[ant]))
                plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=5 * (2 - 1 * float(not outriggers)), fill=True, color='w'))
        
        # plot small red annuli for auto_metrics
        if use_auto_metrics:
            if ant in auto_ex_ants:
                ant_has_flag = True                
                plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=5 * (2 - 1 * float(not outriggers)), fill=True, lw=0, color=autom_color)) 
        
        # plot black/white circles with black outlines for antennas
        plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=4 * (2 - 1 * float(not outriggers)), fill=True, color=['w', 'k'][ant_has_flag], ec='k'))
        if not ant_has_flag:
            unflagged_ants.append(ant)

        # label antennas, using apriori statuses if available
        try:
            bgc = matplotlib.colors.to_rgb(status_colors[a_priori_statuses[ant]])
            c = 'black' if (bgc[0]*0.299 + bgc[1]*0.587 + bgc[2]*0.114) > 186 / 256 else 'white'
        except:
            c = 'k'
            bgc='white'
        plt.text(hd.antpos[ant][0], hd.antpos[ant][1], str(ant), va='center', ha='center', color=c, backgroundcolor=bgc)

    # label nodes
    for node in sorted(set(list(nodes.values()))):
        if not np.isnan(node) and not np.all(np.isnan(node_centers[node])):
            plt.text(node_centers[node][0], node_centers[node][1], str(node), va='center', ha='center', bbox={'color': 'w', 'ec': 'k'})
    
    # build legend 
    legend_objs = []
    legend_labels = []
    
    # use circles for annuli 
    legend_objs.append(matplotlib.lines.Line2D([0], [0], marker='o', color='w', markeredgecolor='k', markerfacecolor='w', markersize=13))
    legend_labels.append(f'{len(unflagged_ants)} / {len(ants)} Total {["Core", "Outrigger"][outriggers]} Antennas Never Flagged')
    legend_objs.append(matplotlib.lines.Line2D([0], [0], marker='o', color='w', markerfacecolor='k', markersize=15))
    legend_labels.append(f'{len(ants) - len(unflagged_ants)} Antennas {["Core", "Outrigger"][outriggers]} Flagged for Any Reason')

    if use_auto_metrics:
        legend_objs.append(matplotlib.lines.Line2D([0], [0], marker='o', color='w', markeredgewidth=2, markeredgecolor=autom_color, markersize=15))
        legend_labels.append(f'{len([ant for ant in auto_ex_ants if ant in ants])} {["Core", "Outrigger"][outriggers]} Antennas Flagged by Auto Metrics')
    if use_ant_metrics: 
        legend_objs.append(matplotlib.lines.Line2D([0], [0], marker='o', color='w', markeredgewidth=2, markeredgecolor=antm_color, markersize=15))
        legend_labels.append(f'{np.round(np.sum([frac for ant, frac in ant_metrics_xants_frac_by_ant.items() if ant in ants]), 2)} Antenna-Nights on' 
                             f'\n{np.sum([frac > 0 for ant, frac in ant_metrics_xants_frac_by_ant.items() if ant in ants])} {["Core", "Outrigger"][outriggers]} Antennas '
                             'Flagged by Ant Metrics\n(alpha indicates fraction of time)')        
    if use_redcal:
        legend_objs.append(matplotlib.lines.Line2D([0], [0], marker='o', color='w', markeredgewidth=2, markeredgecolor=rc_color, markersize=15))
        legend_labels.append(f'{np.round(np.sum(list(redcal_flagged_frac.values())), 2)} Antenna-Nights on' 
                             f'\n{np.sum([frac > 0 for ant, frac in redcal_flagged_frac.items() if ant in ants])} {["Core", "Outrigger"][outriggers]} Antennas '
                             'Flagged by Redcal\n(alpha indicates fraction of time)')

    # use rectangular patches for a priori statuses that appear in the array
    for aps in sorted(list(set(list(a_priori_statuses.values())))):
        if aps != 'Not Found':
            legend_objs.append(plt.Circle((0, 0), radius=7, fill=True, color=status_colors[aps]))
            legend_labels.append(f'A Priori Status:\n{aps} ({[status for ant, status in a_priori_statuses.items() if ant in ants].count(aps)} {["Core", "Outrigger"][outriggers]} Antennas)')

    # label nodes as a white box with black outline
    if len(node_centers) > 0:
        legend_objs.append(matplotlib.patches.Patch(facecolor='w', edgecolor='k'))
        legend_labels.append('Node Number')

    if len(unused_ants) > 0:
        legend_objs.append(matplotlib.lines.Line2D([0], [0], marker='o', color='w', markerfacecolor='grey', markersize=15, alpha=.2))
        legend_labels.append(f'Anntenna Not In Data')
        
    
    plt.legend(legend_objs, legend_labels, ncol=2, fontsize='large', framealpha=1)
    
    if outriggers:
        pass
    else:
        plt.xlim([-200, 150])
        plt.ylim([-150, 150])        
       
    # set axis equal and label everything
    plt.axis('equal')
    plt.tight_layout()
    plt.title(f'Summary of {["Core", "Outrigger"][outriggers]} Antenna Statuses and Metrics on {JD}', size=20)    
    plt.xlabel("Antenna East-West Position (meters)", size=12)
    plt.ylabel("Antenna North-South Position (meters)", size=12)
    plt.xticks(fontsize=12)
    plt.yticks(fontsize=12)
    xlim = plt.gca().get_xlim()
    ylim = plt.gca().get_ylim()    
        
    # plot unused antennas
    plt.autoscale(False)    
    for ant in unused_ants:
        if nodes[ant] in node_centers:
            plt.plot([hd.antpos[ant][0], node_centers[nodes[ant]][0]], 
                     [hd.antpos[ant][1], node_centers[nodes[ant]][1]], 'k', alpha=.2, zorder=0)
        
        plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=4, fill=True, color='w', ec=None, alpha=1, zorder=0))
        plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=4, fill=True, color='grey', ec=None, alpha=.2, zorder=0))
        if hd.antpos[ant][0] < xlim[1] and hd.antpos[ant][0] > xlim[0]:
            if hd.antpos[ant][1] < ylim[1] and hd.antpos[ant][1] > ylim[0]:
                plt.text(hd.antpos[ant][0], hd.antpos[ant][1], str(ant), va='center', ha='center', color='k', alpha=.2) 

Figure 1: Array Plot of Flags and A Priori Statuses¶

This plot shows all antennas, which nodes they are connected to, and their a priori statuses (as the highlight text of their antenna numbers). It may also show (depending on what is finished running):

  • Whether they were flagged by auto_metrics (red circle) for bandpass shape, overall power, temporal variability, or temporal discontinuities. This is done in a binary fashion for the whole night.
  • Whether they were flagged by ant_metrics (green circle) as either dead (on either polarization) or crossed, with the transparency indicating the fraction of the night (i.e. number of files) that were flagged.
  • Whether they were flagged by redcal (blue circle) for high chi^2, with the transparency indicating the fraction of the night (i.e. number of files) that were flagged.

Note that the last fraction does not include antennas that were flagged before going into redcal due to their a priori status, for example.

In [26]:
core_ants = [ant for ant in ants if ant < 320]
outrigger_ants = [ant for ant in ants if ant >= 320]
Plot_Array(ants=core_ants, unused_ants=unused_ants, outriggers=False)
if len(outrigger_ants) > 0:
    Plot_Array(ants=outrigger_ants, unused_ants=sorted(set(unused_ants + core_ants)), outriggers=True)

Metadata¶

In [27]:
from hera_qm import __version__
print(__version__)
from hera_cal import __version__
print(__version__)
2.0.3.dev47+ga570afb
3.1.4.dev14+g122e1cb
In [ ]: